<extend name="./Application/Admin/View/Layout/application.html"/>
<block name="css">
    <link rel="stylesheet" href="__PUBLIC__/vendor/daterangepicker/daterangepicker.css">
    <style>
        .am-icon-heart {
            color: red;
        }

        #copy {
            cursor: pointer;
        }
    </style>
</block>
<block name="content">
    <div class="admin-content">

        <div class="am-cf am-padding">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">订单列表</strong> /
                <small>Order List</small>
            </div>
        </div>

        <hr>
        <div class="am-g">
            <div class="am-u-sm-12 am-u-md-12">
                <form class="am-form-inline" role="form" method="get">

                    <div class="am-form-group">
                        <input type="text" name="order_no" class="am-form-field am-input-sm" placeholder="按订单号"
                               value="{{$_GET['order_no']}}">
                    </div>

                    <div class="am-form-group">
                        <input type="text" name="tel" class="am-form-field am-input-sm" placeholder="按手机号"
                               value="{{$_GET['tel']}}">
                    </div>

                    <div class="am-form-group">
                        <input type="text" id="created_at" placeholder="选择时间日期" name="created_at"
                               value="{{$_GET['created_at']}}" class="am-form-field am-input-sm" style="width: 220px;"/>
                    </div>

                    <div class="am-form-group">
                        <select name="status">
                            <option value="">订单状态</option>
                            <volist name="orderStatus" id="vo">
                                <option value="{{$i-1}}"
                                <if condition="($i-1) eq $_GET['status'] + 1">selected</if>
                                >{{$vo}}</option>
                            </volist>
                        </select>
                    </div>

                    <button type="submit" class="am-btn am-btn-success am-btn-xs">查询</button>
                    <a href="{{:U('Order/index')}}" class="am-btn am-btn-danger am-btn-xs">重置</a>
                </form>
            </div>
        </div>

        <div class="am-g">
            <div class="am-u-sm-12">
                <table class="am-table am-table-striped am-table-hover table-main">
                    <thead>
                    <tr>
                        <th>订单号</th>
                        <th class="table-thumb">收货人</th>
                        <th class="table-title">手机号</th>
                        <th class="table-category">总金额</th>
                        <th class="table-brand">订单状态</th>
                        <th class="table-price">付款时间</th>
                        <th class="table-set">操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    <volist name="orders" id="order">
                        <tr>
                            <td>
                                {{$order.order_no}}&nbsp;&nbsp;&nbsp;&nbsp;
                                <a data-clipboard-text="{{$order.order_no}}" id="copy"
                                   data-am-popover="{theme: 'secondary sm', content: '复制单号', trigger: 'hover focus'}">
                                    <span class="am-badge am-badge-success am-radius">
                                        <span class="am-icon-copy"></span>
                                    </span>
                                </a>
                            </td>
                            <td>{{$order.name}}</td>
                            <td>{{$order.tel}}</td>
                            <td><span class="am-icon-rmb">{{$order.total_price}}元</span></td>
                            <td>
                                <php>if($order['status'] == 0){</php>
                                <a class="am-btn am-btn-warning am-round am-btn-xs am-text-danger" href="">待付款</a>
                                <php>}elseif($order['status'] == 1){</php>
                                <a class="am-btn am-btn-danger am-round am-btn-xs am-text-danger" href="">待发货</a>
                                <php>}elseif($order['status'] == 2){</php>
                                <a class="am-btn am-btn-primary am-round am-btn-xs am-text-danger" href="">已发货</a>
                                <php>}else{</php>
                                <a class="am-btn am-btn-success am-round am-btn-xs am-text-danger" href="">已完成</a>
                                <php>}</php>
                            </td>
                            <td class="am-hide-sm-only">{{$order.created_at|date="Y-m-d H:i:s", ###}}</td>
                            <td>
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs">
                                        <a class="am-btn am-btn-primary am-btn-xs"
                                           href="{{:U('show', ['id'=>$order[id]])}}">
                                            <span class="am-icon-eye"></span> 查看订单
                                        </a>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>

                共 {{$count['orders']}} 条记录

                <div class="am-fr">
                    <ul class="am-pagination">
                        <li class="am-disabled"><a href="javascript:;">«</a></li>
                        {{$show_page}}
                        <li><a href="javascript:;">»</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <footer class="admin-content-footer">
            <hr>
            <p> &nbsp;&nbsp;Copyright © 2017. Made With <i class="am-icon am-icon-heart"></i> By Holy. All
                Rights Reserved.
            </p>
        </footer>
    </div>
</block>
<block name="js">
    <script src="__PUBLIC__/vendor/daterangepicker/moment.js"></script>
    <script src="__PUBLIC__/vendor/moment/locale/zh-cn.js"></script>
    <script src="__PUBLIC__/vendor/daterangepicker/daterangepicker.js"></script>
    <script src="__PUBLIC__/vendor/clipboard/dist/clipboard.min.js"></script>
    <script src="__PUBLIC__/assets/admin/js/daterange_config.js"></script>
    <script>
        $(function () {
            var clipboard = new Clipboard('#copy');
            clipboard.on('success', function () {
                alert('单号已复制');
                return false;
            });
        })
    </script>
</block>
